package com.loobot.album.dao.mapper;
import com.loobot.album.dao.common.CrudMapper;
import com.loobot.album.dao.model.Album;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author: Ike.Fan
 * @date: 2019/3/1.
 */
@Repository
public interface AlbumMapper extends CrudMapper<Album> {
    @Override
    @Select("SELECT count(*) FROM album ")
    int selectCount(Album album);
    @Select("SELECT * FROM album WHERE owner_id =#{ownerId}")
    @Results({
            @Result(property = "id", column = "album_id"),
            @Result(property = "ownerId", column = "owner_id"),
            @Result(property = "projectId",column = "project_id"),
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "updateTime",column = "update_time")
    })

    Album selectByOwnerId(String ownerId);
//    @SelectKey(statement = "select uuid()" ,before = true,resultType = Long.class,keyProperty = "id")
//    @Override
//    int insert(Album relation);
}
